import java.util.Arrays;

public class FillCups {

    public static void main(String[] args) {
        FillCups fillCups = new FillCups();
        int[] nums = {0,2,2};
        System.out.println(fillCups.fillCups(nums));
    }

    public int fillCups1(int[] amount) {
        int ans = 0;
        while (!check(amount)) {
            Arrays.sort(amount);
            amount[2]--;
            amount[1]--;
            ++ans;
        }
        return ans + amount[0] + amount[1] + amount[2];
    }

    public boolean check(int[] nums) {
        int sum = nums[0] + nums[1] + nums[2];
        return sum == nums[0] || sum == nums[1] || sum == nums[2];
    }

    public int fillCups(int[] amount) {
        Arrays.sort(amount);
        int temp = amount[0] + amount[1] - amount[2];
        if (temp <= 0) {
            return amount[2];
        } else {
            return amount[2] + (temp) / 2 + temp % 2;
        }
    }
}
